<%@tag pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions"%>
<c:set var="ctx" value="${pageContext.request.contextPath}" />
<div align="right">
	<script type="text/javascript">
	var LODOP; //声明为全局变量 
	var expressRex="";//运单号正则表达式
	var packformName="";
	var printName="";//打印机名称
	var status="";
	function hideMessage(){
	  $(function() {
				setTimeout(function() {
						$("#message").hide();
					}, 3000);
			});
	}
	function alreadyMyChecked(item) {
		if ($("#check_already" + item).is(":checked")) {

		} else {
			$("#alreadyMyCheckedAll").attr("checked", false);
		}
	}
	function alreadyMyCheckedAll() {
		$("input[name='alreadyMyChecked']").attr("checked",
				$("#alreadyMyCheckedAll").is(":checked"));
	}

	function alreadyMyCheckedAllTWS() {
		var tempChecked = "";
		$("input[type='checkbox'][name='alreadyMyChecked']:checked").each(function() {
		     if(tempChecked==""){
		        tempChecked=$(this).val();
		     }else{
		       tempChecked = tempChecked + ":" + $(this).val();
		     }
		});
		return tempChecked;
	}
	

	function verify(content) {
		var result =content.match(expressRex);
		if(result==null){
		  return false;
		}
		return true;
	}


	function initLodop() {
		LODOP = getLodop(document.getElementById('LODOP_OB'), document
				.getElementById('LODOP_EM'));
	}

	

	function getBodyContentString(content) {
		content = content.replace(/<[^>]*?>(.*?)/gi, '='); //删除左部
		content = content.replace(/(.*?)<\/[^>]*?>/gi, '='); //删除右部
		var bodyContents = content.split("=");
		return bodyContents;
	}

function valSize(item,url){
	
	 if('${fn:length(orderList)}'=='0'){
	    $("#message").html("您没有要打印的订单");
	    $("#message").show();
	    hideMessage();
	   $(item).attr("href","ss");
	   return false;
	 }else{
	   $(item).attr("href","#"+url);  
	 }
	
	     var orders=alreadyMyCheckedAllTWS();
	      var length=orders.split(":").length;
	       if(orders==""){
	          $("#message").html("请选择订单");
	          $("#message").show();
	          hideMessage();
	          $(item).attr("href","ss");
	          return false;
	       }
	      $(item).attr("href","#"+url);  
	     
	      packFormPrinter("guaranteeStylePrint");
	      status="guarantee";
	      $("#guaranteeLabel").html("订单打印:共打印订单("+length+")单");
	       
	 return true;
}

//整除
function Div(exp1, exp2){
    var n1 = Math.round(exp1); //四舍五入
    var n2 = Math.round(exp2); //四舍五入
    var rslt = n1 / n2; //除
    if (rslt >= 0){
        rslt = Math.floor(rslt); //返回值为小于等于其数值参数的最大整数值。
    }else {
        rslt = Math.ceil(rslt); //返回值为大于等于其数字参数的最小整数。
    }
    return rslt;
}



function pageAjaxPrinter(needExpressCompany){
	var orders=alreadyMyCheckedAllTWS();
	   if(orders==""){
		    $("#message").html("请选择订单");
		    $("#message").show();
		    hideMessage();
		    return;
	   }
	   	printName=$("#guaranteeStylePrint").val();
	   	ajaxPrintguaranteeOrdenos(orders);
}

		function ajaxPrintguaranteeOrdenos(orders){
		printName = $("#guaranteeStylePrint").val();
		showBg();
		$.ajax({
			type : 'post',
			url : '${ctx}/v2/workGuaranteeTask/ajaxPrintguaranteeOrdenos',
			data : {
				ordenos:orders
			},
			dataType : 'json',
			success : function(data) {
				if (data.status == "1") {
				if(data.shopCode == "HD0004"){
						$.each(data.workOrders,function(i,v){
							printGuaranteeYFH(v,printName);
						});
					}else if(data.shopCode == "HD0064"){
						$.each(data.workOrders,function(i,v){
							printGuaranteeTTG(v,printName);
						});
					}else if(data.shopCode == "HD0081"){
						$.each(data.workOrders,function(i,v){
							printGuaranteeMH(v,printName);
						});
					}else if(data.shopCode == "HD0013"){
						$.each(data.workOrders,function(i,v){
							printGuaranteeJS(v,printName);
						});
					}else if(data.shopCode == "HD0041"){
						$.each(data.workOrders,function(i,v){
							printGuaranteeHF(v,printName);
						});
					}else if(data.shopCode == "HD0007"){
						$.each(data.workOrders,function(i,v){
							printGuaranteeCY(v,printName);
						});
					}else if(data.shopCode == "HD0056"){
						$.each(data.workOrders,function(i,v){
							printGuaranteeQY(v,printName);
						});
					}else if(data.shopCode == "HD0055"){
						$.each(data.workOrders,function(i,v){
							printGuaranteeXY(v,printName);
						});
					}else if(data.shopCode == "HD0066"){
						$.each(data.workOrders,function(i,v){
							printGuaranteeTY(v,printName);
						});
					}else if(data.shopCode == "HD0043"){
						$.each(data.workOrders,function(i,v){
							printGuaranteeBoYou(v,printName);
						});
					}else if(data.shopCode == "HD0084"){
						$.each(data.workOrders,function(i,v){
							printGuaranteeSMei(v,printName);
						});
					}else if(data.shopCode == "HD0060"){
						$.each(data.workOrders,function(i,v){
							printGuaranteeHYu(v,printName);
						});
					}else if(data.shopCode == "HD0093"){
						$.each(data.workOrders,function(i,v){
							printGuaranteeYBH(v,printName);
						});
					}else if(data.shopCode == "HD0058"){
						$.each(data.workOrders,function(i,v){
							printGuaranteeYKu(v,printName);
						});
					}
					closeBg();
					} else {
						closeBg();
					}
				 }
		});
	}
	//盈丰行
	function printGuaranteeYFH(workOrder,printName){
		LODOP.PRINT_INIT(workOrder.order.ordeno);
		LODOP.SET_PRINT_PAGESIZE(1,2400,1399,""); 
		var height=0;
		LODOP.ADD_PRINT_TEXT(60,'120mm',140,40,workOrder.batchCode);
		LODOP.ADD_PRINT_TEXT(90,'120mm',140,40,workOrder.taskCode+"_"+workOrder.rankno);
		LODOP.ADD_PRINT_TEXT(120,'120mm',140,40,"商业");
		LODOP.ADD_PRINT_TEXT(120,'50mm',140,40,new Date().Format("yyyy-MM-dd hh:mm:ss"));
		var count = 0;
		var order = workOrder.order.orderItems;
		for(var i =0;i<order.length;i++){
			height = height+30;
			LODOP.ADD_PRINT_TEXT(200+height,'50mm',140,40,order[i].nam);
			LODOP.ADD_PRINT_TEXT(200+height,'120mm',140,80,order[i].des);
			LODOP.ADD_PRINT_TEXT(200+height,'140mm',140,40,order[i].qty);
			LODOP.ADD_PRINT_TEXT(200+height,'160mm',140,80,order[i].pri);
			LODOP.ADD_PRINT_TEXT(200+height,'180mm',140,40,(order[i].pri)*(order[i].qty));
			count+=(order[i].pri)*(order[i].qty);
		}
		LODOP.ADD_PRINT_TEXT(390,'150mm',40,40,count);
		LODOP.ADD_PRINT_TEXT(440,'50mm',40,40,"梁欣");
		LODOP.ADD_PRINT_TEXT(440,'100mm',40,40,"梁欣");
		LODOP.ADD_PRINT_TEXT(440,'120mm',250,100,"佛山市顺德区盈丰行网络科技有限公司");
		if (LODOP.SET_PRINTER_INDEXA(printName)) {
			LODOP.PRINT(); 
		}
	}
	//美的壹佰汇
	function printGuaranteeYBH(workOrder,printName){
		LODOP.PRINT_INIT(workOrder.order.ordeno);
		LODOP.SET_PRINT_PAGESIZE(1,2400,1399,""); 
		var height=0;
		LODOP.ADD_PRINT_TEXT(60,'120mm',140,40,workOrder.batchCode);
		LODOP.ADD_PRINT_TEXT(90,'120mm',140,40,workOrder.taskCode+"_"+workOrder.rankno);
		LODOP.ADD_PRINT_TEXT(120,'120mm',140,40,"商业");
		LODOP.ADD_PRINT_TEXT(120,'50mm',140,40,new Date().Format("yyyy-MM-dd hh:mm:ss"));
		var count = 0;
		var order = workOrder.order.orderItems;
		for(var i =0;i<order.length;i++){
			height = height+30;
			LODOP.ADD_PRINT_TEXT(200+height,'50mm',140,40,order[i].nam);
			LODOP.ADD_PRINT_TEXT(200+height,'120mm',140,80,order[i].des);
			LODOP.ADD_PRINT_TEXT(200+height,'140mm',140,40,order[i].qty);
			LODOP.ADD_PRINT_TEXT(200+height,'160mm',140,80,order[i].pri);
			LODOP.ADD_PRINT_TEXT(200+height,'180mm',140,40,(order[i].pri)*(order[i].qty));
			count+=(order[i].pri)*(order[i].qty);
		}
		LODOP.ADD_PRINT_TEXT(390,'150mm',40,40,count);
		LODOP.ADD_PRINT_TEXT(440,'50mm',40,40,"谢骑");
		LODOP.ADD_PRINT_TEXT(440,'100mm',40,40,"谢骑");
		LODOP.ADD_PRINT_TEXT(440,'120mm',250,100,"美的壹佰汇电子商务有限公司");
		if (LODOP.SET_PRINTER_INDEXA(printName)) {
			LODOP.PRINT(); 
		}
	}
	//天天购
	function printGuaranteeTTG(workOrder,printName){
		LODOP.PRINT_INIT(workOrder.order.ordeno);
		LODOP.SET_PRINT_PAGESIZE(1,2000,1015,""); 
		var height=0;
		LODOP.ADD_PRINT_TEXT(30,'90mm',140,40,workOrder.batchCode);
		LODOP.ADD_PRINT_TEXT(30,'140mm',140,40,workOrder.taskCode+"_"+workOrder.rankno);
		LODOP.ADD_PRINT_TEXT(60,'25mm',140,40,new Date().Format("yyyy-MM-dd hh:mm:ss"));
		LODOP.ADD_PRINT_TEXT(60,'140mm',140,40,MathRand());
		var count = 0;
		var order = workOrder.order.orderItems;
		for(var i =0;i<order.length;i++){
			height = height+30;
			LODOP.ADD_PRINT_TEXT(100+height,'30mm',140,40,order[i].nam);
			LODOP.ADD_PRINT_TEXT(100+height,'70mm',140,80,order[i].des);
			LODOP.ADD_PRINT_TEXT(100+height,'100mm',140,40,order[i].qty);
			LODOP.ADD_PRINT_TEXT(100+height,'120mm',140,80,order[i].pri);
			LODOP.ADD_PRINT_TEXT(100+height,'140mm',140,40,(order[i].pri)*(order[i].qty));
			count+=(order[i].pri)*(order[i].qty);
		}
		var numToCny = LODOP.format("UpperMoney",count);
		LODOP.ADD_PRINT_TEXT(230,'30mm',140,800,numToCny);
		LODOP.ADD_PRINT_TEXT(230,'120mm',140,800,"合计");
		LODOP.ADD_PRINT_TEXT(230,'140mm',140,800,count);
		if (LODOP.SET_PRINTER_INDEXA(printName)) {
			LODOP.PRINT(); 
		}
	}
	//明辉
	function printGuaranteeMH(workOrder,printName){
		LODOP.PRINT_INIT(workOrder.order.ordeno);
		LODOP.SET_PRINT_PAGESIZE(1,1900,1015,""); 
		var height=0;
		LODOP.ADD_PRINT_TEXT(30,'20mm',140,40,workOrder.batchCode);
		LODOP.ADD_PRINT_TEXT(50,'20mm',140,40,workOrder.taskCode+"_"+workOrder.rankno);
		LODOP.ADD_PRINT_TEXT(70,'20mm',140,40,MathRand());
		LODOP.ADD_PRINT_TEXT(100,'20mm',140,40,new Date().Format("yyyy-MM-dd hh:mm:ss"));
		
		var count = 0;
		var order = workOrder.order.orderItems;
		for(var i =0;i<order.length;i++){
			height = height+30;
			LODOP.ADD_PRINT_TEXT(130+height,'30mm',140,40,order[i].nam);
			LODOP.ADD_PRINT_TEXT(130+height,'70mm',140,80,order[i].des);
			LODOP.ADD_PRINT_TEXT(130+height,'100mm',140,40,order[i].qty);
			LODOP.ADD_PRINT_TEXT(130+height,'120mm',140,80,order[i].pri);
			LODOP.ADD_PRINT_TEXT(130+height,'150mm',140,40,(order[i].pri)*(order[i].qty));
			count+=(order[i].pri)*(order[i].qty);
		}
		LODOP.ADD_PRINT_TEXT(240,'30mm',250,800,"美的全国服务热线:4008899315");
		LODOP.ADD_PRINT_TEXT(270,'30mm',300,800,"亲,如需退换货时，请将此保修单一并寄回，非常感谢亲的配合！");
		if (LODOP.SET_PRINTER_INDEXA(printName)) {
			LODOP.PRINT(); 
		}
	}
	//恒飞
	function printGuaranteeHF(workOrder,printName){
		LODOP.PRINT_INIT(workOrder.order.ordeno);
		LODOP.SET_PRINT_PAGESIZE(1,2100,1400,""); 
		var height=0;
		LODOP.ADD_PRINT_TEXT(10,'30mm',140,40,workOrder.batchCode);
		LODOP.ADD_PRINT_TEXT(30,'30mm',140,40,workOrder.taskCode+"_"+workOrder.rankno);
		LODOP.ADD_PRINT_TEXT(50,'30mm',140,40,MathRand());
		LODOP.ADD_PRINT_TEXT(100,'35mm',140,40,new Date().Format("yyyy-MM-dd hh:mm:ss"));
		
		var count = 0;
		var ediorder = workOrder.order;
		var order = workOrder.order.orderItems;
		LODOP.ADD_PRINT_TEXT(120,'30mm',140,40,"顾客名称:"+ediorder.recena);
		LODOP.ADD_PRINT_TEXT(140,'30mm',140,40,"品名规格");
		LODOP.ADD_PRINT_TEXT(140,'90mm',140,40,"单位");
		LODOP.ADD_PRINT_TEXT(140,'120mm',140,40,"数量");
		LODOP.ADD_PRINT_TEXT(140,'150mm',140,40,"单价");
		LODOP.ADD_PRINT_TEXT(140,'180mm',140,40,"金额");
		for(var i =0;i<order.length;i++){
			height = height+30;
			LODOP.ADD_PRINT_TEXT(140+height,'30mm',140,40,order[i].nam);
			LODOP.ADD_PRINT_TEXT(140+height,'90mm',140,80,order[i].des);
			LODOP.ADD_PRINT_TEXT(140+height,'120mm',140,40,order[i].qty);
			LODOP.ADD_PRINT_TEXT(140+height,'150mm',140,80,order[i].pri);
			LODOP.ADD_PRINT_TEXT(140+height,'180mm',140,40,(order[i].pri)*(order[i].qty));
			count+=(order[i].pri)*(order[i].qty);
		}
		var numToCny = LODOP.format("UpperMoney",count);
		LODOP.ADD_PRINT_TEXT(350,'30mm',300,800,"合计金额(大写):"+numToCny);
		LODOP.ADD_PRINT_TEXT(370,'30mm',300,800,"备注:"+ediorder.remark);
		LODOP.ADD_PRINT_TEXT(390,'30mm',300,800,"开票人:谢艳兰");
		LODOP.ADD_PRINT_TEXT(350,'160mm',140,800,"合计(小写):"+count);
		if (LODOP.SET_PRINTER_INDEXA(printName)) {
			LODOP.PRINT(); 
		}
	}
	//金森
	function printGuaranteeJS(workOrder,printName){
		LODOP.PRINT_INIT(workOrder.order.ordeno);
		LODOP.SET_PRINT_PAGESIZE(1,1900,1016,""); 
		var height=0;
		var ediorder = workOrder.order;
		LODOP.ADD_PRINT_TEXT(40,'40mm',140,40,workOrder.batchCode);
		LODOP.ADD_PRINT_TEXT(60,'40mm',140,40,workOrder.taskCode+"_"+workOrder.rankno);
		LODOP.ADD_PRINT_TEXT(80,'40mm',140,40,new Date().Format("yyyy-MM-dd hh:mm:ss"));
		LODOP.ADD_PRINT_TEXT(80,'80mm',140,40,ediorder.recena);
		var count = 0;
		var order = workOrder.order.orderItems;
		for(var i =0;i<order.length;i++){
			height = height+30;
			LODOP.ADD_PRINT_TEXT(100+height,'40mm',140,40,order[i].nam);
			LODOP.ADD_PRINT_TEXT(100+height,'100mm',140,80,order[i].des);
			LODOP.ADD_PRINT_TEXT(100+height,'120mm',140,40,order[i].qty);
			LODOP.ADD_PRINT_TEXT(100+height,'140mm',140,80,order[i].pri);
			LODOP.ADD_PRINT_TEXT(100+height,'160mm',140,40,(order[i].pri)*(order[i].qty));
			count+=(order[i].pri)*(order[i].qty);
		}
		var numToCny = LODOP.format("UpperMoney",count);
		LODOP.ADD_PRINT_TEXT(270,'30mm',140,80,numToCny);
		LODOP.ADD_PRINT_TEXT(270,'160mm',140,80,count);
		if (LODOP.SET_PRINTER_INDEXA(printName)) {
			LODOP.PRINT(); 
		}
	}
	//楚鹰
	function printGuaranteeCY(workOrder,printName){
		LODOP.PRINT_INIT(workOrder.order.ordeno);
		LODOP.SET_PRINT_PAGESIZE(1,2000,1100,""); 
		var height=0;
		LODOP.ADD_PRINT_TEXT(60,'150mm',140,40,workOrder.batchCode);
		LODOP.ADD_PRINT_TEXT(90,'150mm',140,40,workOrder.taskCode+"_"+workOrder.rankno);
		LODOP.ADD_PRINT_TEXT(120,'30mm',140,40,new Date().Format("yyyy-MM-dd hh:mm:ss"));
		
		LODOP.ADD_PRINT_TEXT(120,'150mm',140,40,MathRand());
		var count = 0;
		var order = workOrder.order.orderItems;
		for(var i =0;i<order.length;i++){
			height = height+30;
			LODOP.ADD_PRINT_TEXT(170+height,'30mm',140,40,order[i].nam);
			LODOP.ADD_PRINT_TEXT(170+height,'70mm',140,80,order[i].des);
			LODOP.ADD_PRINT_TEXT(170+height,'100mm',140,40,order[i].qty);
			LODOP.ADD_PRINT_TEXT(170+height,'120mm',140,80,order[i].pri);
			LODOP.ADD_PRINT_TEXT(170+height,'150mm',140,40,(order[i].pri)*(order[i].qty));
			count+=(order[i].pri)*(order[i].qty);
		}
		var numToCny = LODOP.format("UpperMoney",count);
		LODOP.ADD_PRINT_TEXT(330,'30mm',140,800,numToCny);
		LODOP.ADD_PRINT_TEXT(330,'120mm',140,800,"合计");
		LODOP.ADD_PRINT_TEXT(330,'150mm',140,800,count);
		if (LODOP.SET_PRINTER_INDEXA(printName)) {
			LODOP.PRINT(); 
		}
	}
	//桥一
	function printGuaranteeQY(workOrder,printName){
		var ediorder = workOrder.order;
		LODOP.PRINT_INIT(workOrder.order.ordeno);
		LODOP.SET_PRINT_PAGESIZE(1,1900,1020,""); 
		var height=0;
		LODOP.ADD_PRINT_TEXT(30,'20mm',140,40,workOrder.batchCode);
		LODOP.ADD_PRINT_TEXT(50,'20mm',140,40,workOrder.taskCode+"_"+workOrder.rankno);
		LODOP.ADD_PRINT_TEXT(100,'40mm',140,40,new Date().Format("yyyy-MM-dd hh:mm:ss"));
		LODOP.ADD_PRINT_TEXT(100,'120mm',140,40,"电器");
		LODOP.ADD_PRINT_TEXT(120,'30mm',140,40,"顾客名称:"+ediorder.recena);
		LODOP.ADD_PRINT_TEXT(140,'30mm',140,40,"商品名称");
		LODOP.ADD_PRINT_TEXT(140,'85mm',140,40,"单位");
		LODOP.ADD_PRINT_TEXT(140,'105mm',140,40,"数量");
		LODOP.ADD_PRINT_TEXT(140,'125mm',140,40,"单价");
		LODOP.ADD_PRINT_TEXT(140,'145mm',140,40,"金额");
		var count = 0;
		var order = workOrder.order.orderItems;
		for(var i =0;i<order.length;i++){
			height = height+30;
			LODOP.ADD_PRINT_TEXT(140+height,'30mm',140,40,order[i].nam);
			LODOP.ADD_PRINT_TEXT(140+height,'85mm',140,80,order[i].des);
			LODOP.ADD_PRINT_TEXT(140+height,'105mm',140,40,order[i].qty);
			LODOP.ADD_PRINT_TEXT(140+height,'125mm',140,80,order[i].pri);
			LODOP.ADD_PRINT_TEXT(140+height,'145mm',140,40,(order[i].pri)*(order[i].qty));
			count+=(order[i].pri)*(order[i].qty);
		}
		var numToCny = LODOP.format("UpperMoney",count);
		LODOP.ADD_PRINT_TEXT(250,'30mm',250,800,"合计金额大写:"+numToCny);
		LODOP.ADD_PRINT_TEXT(250,'120mm',250,800,"合计金额小写:￥"+count);
		LODOP.ADD_PRINT_TEXT(310,'100mm',300,800,"陈秋");
		if (LODOP.SET_PRINTER_INDEXA(printName)) {
			LODOP.PRINT(); 
		}
	}
	//上海心羽
	function printGuaranteeXY(workOrder,printName){
		LODOP.PRINT_INIT(workOrder.order.ordeno);
		LODOP.SET_PRINT_PAGESIZE(1,1940,1016,""); 
		var height=0;
		LODOP.ADD_PRINT_TEXT(10,'25mm',140,40,workOrder.batchCode);
		LODOP.ADD_PRINT_TEXT(30,'25mm',140,40,workOrder.taskCode+"_"+workOrder.rankno);
		LODOP.ADD_PRINT_TEXT(70,'35mm',140,40,new Date().Format("yyyy-MM-dd hh:mm:ss"));
		LODOP.ADD_PRINT_TEXT(85,'52mm',140,40,"个人");
		var count = 0;
		var order = workOrder.order.orderItems;
		for(var i =0;i<order.length;i++){
			height = height+30;
			LODOP.ADD_PRINT_TEXT(120+height,'25mm',180,40,order[i].nam);
			LODOP.ADD_PRINT_TEXT(120+height,'80mm',140,80,order[i].pri);
			LODOP.ADD_PRINT_TEXT(120+height,'120mm',140,40,order[i].qty);
			LODOP.ADD_PRINT_TEXT(120+height,'145mm',140,40,(order[i].pri)*(order[i].qty));
			count+=(order[i].pri)*(order[i].qty);
		}
		var numToCny = LODOP.format("UpperMoney",count);
		LODOP.ADD_PRINT_TEXT(272,'85mm',140,800,numToCny);
		LODOP.ADD_PRINT_TEXT(272,'145mm',140,800,count);
		LODOP.ADD_PRINT_TEXT(300,'130mm',200,800,"上海农商银行黄渡支行");
		LODOP.ADD_PRINT_TEXT(325,'105mm',140,800,"洪佳妮");
		LODOP.ADD_PRINT_TEXT(325,'145mm',140,800,"宋燕");
		if (LODOP.SET_PRINTER_INDEXA(printName)) {
			LODOP.PRINT(); 
		}
	}
	//上海泰域
	function printGuaranteeTY(workOrder,printName){
		var ediorder = workOrder.order;
		LODOP.PRINT_INIT(workOrder.order.ordeno);
		LODOP.SET_PRINT_PAGESIZE(1,1900,1015,""); 
		var height=0;
		LODOP.ADD_PRINT_TEXT(10,'20mm',140,40,workOrder.batchCode);
		LODOP.ADD_PRINT_TEXT(30,'20mm',140,40,workOrder.taskCode+"_"+workOrder.rankno);
		LODOP.ADD_PRINT_TEXT(60,'25mm',140,40,new Date().Format("yyyy-MM-dd hh:mm:ss"));
		LODOP.ADD_PRINT_TEXT(100,'40mm',140,40,ediorder.recena);
		var count = 0;
		var order = workOrder.order.orderItems;
		for(var i =0;i<order.length;i++){
			height = height+30;
			LODOP.ADD_PRINT_TEXT(120+height,'20mm',250,40,order[i].nam);
			LODOP.ADD_PRINT_TEXT(120+height,'100mm',140,40,order[i].qty);
			LODOP.ADD_PRINT_TEXT(120+height,'130mm',140,40,(order[i].pri)*(order[i].qty));
			count+=(order[i].pri)*(order[i].qty);
		}
		var numToCny = LODOP.format("UpperMoney",count);
		LODOP.ADD_PRINT_TEXT(220,'50mm',250,140,numToCny);
		LODOP.ADD_PRINT_TEXT(220,'120mm',300,140,count);
		if (LODOP.SET_PRINTER_INDEXA(printName)) {
			LODOP.PRINT(); 
		}
	}
	//博佑
	function printGuaranteeBoYou(workOrder,printName){
		var ediorder = workOrder.order;
		LODOP.PRINT_INIT(workOrder.order.ordeno);
		LODOP.SET_PRINT_PAGESIZE(1,2100,1410,""); 
		var height=0;
		LODOP.ADD_PRINT_TEXT(25,'40mm',140,40,workOrder.batchCode);
		LODOP.ADD_PRINT_TEXT(55,'40mm',140,40,workOrder.taskCode+"_"+workOrder.rankno);
		LODOP.ADD_PRINT_TEXT(100,'40mm',140,40,new Date().Format("yyyy-MM-dd hh:mm:ss"));
		LODOP.ADD_PRINT_TEXT(100,'100mm',140,40,"商业");
		LODOP.ADD_PRINT_TEXT(140,'30mm',140,40,"项目");
		LODOP.ADD_PRINT_TEXT(140,'80mm',140,40,"单位");
		LODOP.ADD_PRINT_TEXT(140,'100mm',140,40,"数量");
		LODOP.ADD_PRINT_TEXT(140,'120mm',140,40,"单价");
		LODOP.ADD_PRINT_TEXT(140,'140mm',140,40,"金额");
		var count = 0;
		var order = workOrder.order.orderItems;
		for(var i =0;i<order.length;i++){
			height = height+30;
			LODOP.ADD_PRINT_TEXT(140+height,'30mm',140,40,order[i].nam);
			LODOP.ADD_PRINT_TEXT(140+height,'80mm',140,80,order[i].des);
			LODOP.ADD_PRINT_TEXT(140+height,'100mm',140,40,order[i].qty);
			LODOP.ADD_PRINT_TEXT(140+height,'120mm',140,80,order[i].pri);
			LODOP.ADD_PRINT_TEXT(140+height,'140mm',140,40,(order[i].pri)*(order[i].qty));
			count+=(order[i].pri)*(order[i].qty);
		}
		var numToCny = LODOP.format("UpperMoney",count);
		LODOP.ADD_PRINT_TEXT(330,'30mm',250,800,"合计金额大写:"+numToCny);
		LODOP.ADD_PRINT_TEXT(330,'120mm',250,800,"合计金额小写:￥"+count);
		LODOP.ADD_PRINT_TEXT(370,'30mm',300,800,"开票人：王艳明");
		LODOP.ADD_PRINT_TEXT(370,'50mm',300,800,"收款人：王艳明");
		LODOP.ADD_PRINT_TEXT(370,'80mm',300,800,"开票单位（盖章）：佛山市博佑贸易有限公司");
		if (LODOP.SET_PRINTER_INDEXA(printName)) {
			LODOP.PRINT(); 
		}
	}
	//长沙生美
	function printGuaranteeSMei(workOrder,printName){
		LODOP.PRINT_INIT(workOrder.order.ordeno);
		LODOP.SET_PRINT_PAGESIZE(1,2100,1400,""); 
		var height=0;
		LODOP.ADD_PRINT_TEXT(40,'30mm',140,40,workOrder.batchCode);
		LODOP.ADD_PRINT_TEXT(60,'30mm',140,40,workOrder.taskCode+"_"+workOrder.rankno);
		LODOP.ADD_PRINT_TEXT(110,'40mm',80,40,new Date().Format("yyyy-MM-dd hh:mm:ss"));
		
		var count = 0;
		var ediorder = workOrder.order;
		var order = workOrder.order.orderItems;
		LODOP.ADD_PRINT_TEXT(110,'90mm',140,40,ediorder.recena);
		for(var i =0;i<order.length;i++){
			height = height+30;
			LODOP.ADD_PRINT_TEXT(180+height,'30mm',140,40,order[i].nam);
			LODOP.ADD_PRINT_TEXT(180+height,'90mm',140,80,order[i].des);
			LODOP.ADD_PRINT_TEXT(180+height,'120mm',140,40,order[i].qty);
			LODOP.ADD_PRINT_TEXT(180+height,'150mm',140,80,order[i].pri);
			LODOP.ADD_PRINT_TEXT(180+height,'180mm',140,40,(order[i].pri)*(order[i].qty));
			count+=(order[i].pri)*(order[i].qty);
		}
		var numToCny = LODOP.format("UpperMoney",count);
		LODOP.ADD_PRINT_TEXT(380,'50mm',300,800,numToCny);
		LODOP.ADD_PRINT_TEXT(380,'170mm',140,800,count);
		LODOP.ADD_PRINT_TEXT(410,'40mm',240,800,"长沙生美电子商务有限公司");
		LODOP.ADD_PRINT_TEXT(410,'170mm',140,800,"韩伦");
		if (LODOP.SET_PRINTER_INDEXA(printName)) {
			LODOP.PRINT(); 
		}
	}
	//浩宇博海
	function printGuaranteeHYu(workOrder,printName){
		LODOP.PRINT_INIT(workOrder.order.ordeno);
		LODOP.SET_PRINT_PAGESIZE(1,1900,1015,""); 
		var height=0;
		LODOP.ADD_PRINT_TEXT(40,'30mm',140,40,workOrder.batchCode);
		LODOP.ADD_PRINT_TEXT(60,'30mm',140,40,workOrder.taskCode+"_"+workOrder.rankno);
		LODOP.ADD_PRINT_TEXT(80,'30mm',80,40,new Date().Format("yyyy-MM-dd hh:mm:ss"));
		
		var count = 0;
		var ediorder = workOrder.order;
		var order = workOrder.order.orderItems;
		LODOP.ADD_PRINT_TEXT(80,'90mm',140,40,ediorder.recena);
		for(var i =0;i<order.length;i++){
			height = height+30;
			LODOP.ADD_PRINT_TEXT(130+height,'30mm',140,40,order[i].nam);
			LODOP.ADD_PRINT_TEXT(130+height,'70mm',140,80,order[i].des);
			LODOP.ADD_PRINT_TEXT(130+height,'100mm',140,40,order[i].qty);
			LODOP.ADD_PRINT_TEXT(130+height,'120mm',140,80,order[i].pri);
			LODOP.ADD_PRINT_TEXT(130+height,'150mm',140,40,(order[i].pri)*(order[i].qty));
			count+=(order[i].pri)*(order[i].qty);
		}
		var numToCny = LODOP.format("UpperMoney",count);
		LODOP.ADD_PRINT_TEXT(270,'50mm',300,800,numToCny);
		LODOP.ADD_PRINT_TEXT(290,'130mm',140,800,"李辉");
		if (LODOP.SET_PRINTER_INDEXA(printName)) {
			LODOP.PRINT(); 
		}
	}
			//易酷
	function printGuaranteeYKu(workOrder,printName){
		var ediorder = workOrder.order;
		LODOP.PRINT_INIT(workOrder.order.ordeno);
		LODOP.SET_PRINT_PAGESIZE(1,2100,1400,""); 
		var height=0;
		LODOP.ADD_PRINT_TEXT(40,'20mm',140,40,workOrder.batchCode);
		LODOP.ADD_PRINT_TEXT(50,'20mm',140,40,workOrder.taskCode+"_"+workOrder.rankno);
		LODOP.ADD_PRINT_TEXT(80,'20mm',80,40,new Date().Format("yyyy-MM-dd hh:mm:ss"));
		LODOP.ADD_PRINT_TEXT(80,'90mm',80,40,"商业");
		LODOP.ADD_PRINT_TEXT(110,'20mm',140,40,"顾客名称:"+ediorder.recena);
		LODOP.ADD_PRINT_TEXT(130,'20mm',140,40,"项目:");
		LODOP.ADD_PRINT_TEXT(130,'60mm',140,40,"单位:");
		LODOP.ADD_PRINT_TEXT(130,'90mm',140,40,"数量:");
		LODOP.ADD_PRINT_TEXT(130,'110mm',140,40,"单价:");
		LODOP.ADD_PRINT_TEXT(130,'130mm',140,40,"金额:");
		var count = 0;
		var ediorder = workOrder.order;
		var order = workOrder.order.orderItems;
		for(var i =0;i<order.length;i++){
			height = height+30;
			LODOP.ADD_PRINT_TEXT(130+height,'20mm',140,40,order[i].nam);
			LODOP.ADD_PRINT_TEXT(130+height,'60mm',140,80,order[i].des);
			LODOP.ADD_PRINT_TEXT(130+height,'90mm',140,40,order[i].qty);
			LODOP.ADD_PRINT_TEXT(130+height,'110mm',140,80,order[i].pri);
			LODOP.ADD_PRINT_TEXT(130+height,'130mm',140,40,(order[i].pri)*(order[i].qty));
			count+=(order[i].pri)*(order[i].qty);
		}
		var numToCny = LODOP.format("UpperMoney",count);
		LODOP.ADD_PRINT_TEXT(300,'30mm',300,800,"合计金额大写(人民币):"+numToCny);
		LODOP.ADD_PRINT_TEXT(300,'110mm',140,800,"合计金额小写:￥"+count);
		LODOP.ADD_PRINT_TEXT(350,'30mm',140,800,"开票人：蔡文洁");
		LODOP.ADD_PRINT_TEXT(350,'70mm',140,800,"收款人：");
		LODOP.ADD_PRINT_TEXT(350,'100mm',300,800,"开票单位（盖章）广东易酷电子商务有限公司");
		if (LODOP.SET_PRINTER_INDEXA(printName)) {
			LODOP.PRINT(); 
		}
	}
	 function numToCny(num) {
        ///<summery>小写金额转化大写金额</summery>
        ///<param name=num type=number>金额</param>
        if(isNaN(num))return "无效数值！";
        var strPrefix="";
        if(num<0)strPrefix ="(负)";
        num=Math.abs(num);
        if(num>=1000000000000)return "无效数值！";
        var strOutput = "";
        var strUnit = '仟佰拾亿仟佰拾万仟佰拾元角分';
        var strCapDgt='零壹贰叁肆伍陆柒捌玖';
        num += "00";
        var intPos = num.indexOf('.');
        if (intPos >= 0){
            num = num.substring(0, intPos) + num.substr(intPos + 1, 2);
        }
        strUnit = strUnit.substr(strUnit.length - num.length);
        for (var i=0; i < num.length; i++){
            strOutput += strCapDgt.substr(num.substr(i,1),1) + strUnit.substr(i,1);
        }
        return strPrefix+strOutput.replace(/零角零分$/, '整').replace(/零[仟佰拾]/g, '零').replace(/零{2,}/g, '零').replace(/零([亿|万])/g, '$1').replace(/零+元/, '元').replace(/亿零{0,3}万/, '亿').replace(/^元/, "零元");
    }	
    function MathRand()
    {
    var Num="";
    for(var i=0;i<6;i++)
    {
    Num+=Math.floor(Math.random()*10);
    }
    return Num;
    }		
</script>
</div>
<div id="fullbg"></div>
<div id="dialog">
	<div>
		<img src="${ctx }/static/022.gif"></img>
	</div>
</div>



<script type="text/javascript">
$("#printer").click(function(){
$("#printer").attr("disabled", "disabled");
  pageAjaxPrinter();
});
	if("express"=='${status}'){
	  
	}
	//getAjaxExpress();
	//getAjaxPackformStyle();
</script>
<div class="row">
	<div>
		<a href="#printGuarantee" role="button" data-toggle="modal"
			class="btn btn-primary" onclick="valSize(this,'printGuarantee');"
			style="margin-left: 20px;">打印保修单</a>
	</div>

</div>


<div class="modal  fade"
			tabindex="-1" role="dialog" aria-labelledby="myModalLabel"
			aria-hidden="true" id="printGuarantee">
			<div class="modal-dialog">
				<div class="modal-content">
					<div class="modal-header">
						<h3 id="guaranteeLabel">
		                                                        打印保修单信息
						</h3>
						<span id="messageLable"></span>
					</div>
					<div class="modal-body"  style="overflow: auto;">
						<div class="form-group row">
						    <div class="col-sm-9">
								<div class="input-group col-sm-12">
									<span class="input-group-text">   选择打印机: </span> 
									<select id="guaranteeStylePrint" name="packFormPrinter"  class="form-control">
		
									</select>
								</div>
							</div>
						</div>
					</div>
		
		               <div class="modal-footer">
						<a class="btn btn-primary" data-dismiss="modal" aria-hidden="true"
							onclick="pageAjaxPrinter()"> 立即打印 </a>
						<a class="btn" data-dismiss="modal" aria-hidden="true"> 关闭 </a>
					</div>
					
				</div>
			</div>
		</div>


